from PyQt4.QtCore import *
from PyQt4.QtGui import *

import scene
import items
import insouts

from layout import Ui_Dialog
class GraphDialog(QDialog,Ui_Dialog):
    def __init__(self):
        QDialog.__init__(self)
        self.setupUi(self)
        self.scene = scene.modelScene()
        self.graphicsView.setScene(self.scene)

        self.ins = [insouts.input("A"),insouts.input("B")]
        self.outs = [insouts.output("A + B")]
        self.items = [
            items.Rect(0,0,self.ins,self.outs,"add"),
            items.Rect(100,0,self.ins,self.outs,"diff"),
            ]
        [self.scene.addItem(i) for i in self.items]

def main(args):
    app = QApplication(args)
    mainWindow=GraphDialog()
    mainWindow.show()
    app.exec_()

    
import sys
if __name__=="__main__":
    main(sys.argv)
